Gravitational Dynamics

Declare one, two, three, or N point masses; compile the equation of motion for each body; propagate the actual initial-value problem; and audit every invariant the assumptions permit. One mass is inertial; an isolated, unsoftened Newtonian pair reduces exactly to Kepler; and general N ≥ 3 systems are solved numerically without pretending a closed form exists.

Newton 1687 · Lagrange 1788 · Hamilton 1834 · Yoshida 1990 · Dormand & Prince 1980
HONESTY TIER  A/B · DIRECT FORCE SUM + DECLARED NUMERICAL PROPAGATION
GravityN-body
N = 2
declared point masses
1
unordered force pairs
8
active first-order variables
Yoshida 4
active propagator
relative energy error
A
active scientific stage
Stage A · Declared geometry · pair inventory

Every interaction begins with a separation vector

The current bodies, barycenter, and all unordered pair connections are shown directly from the state table. For large N, line opacity is reduced rather than hiding interactions.

Scientific stage

Initial-condition preset
Model units
Spatial dimension
Numerical propagator
Evolution
View
drag to orbit · scroll to zoom · labels resolve projected overlap

Live dynamics

A · DIRECT GEOMETRY — every node and pair comes from the declared state
timet = 0 s
solvernot built
total declared mass
energy ΔE/Escale
momentum drift
angular drift
barycenter drift
minimum separation
camera projectionclear
last accepted h
accepted / rejected0 / 0
force evaluations0
ENERGY RESIDUAL · raw + rolling RMS

Conservation diagnostics are meaningful for closed systems without externally fixed bodies.

MODEL TIME · t = 0 s
initial / fixed step Δtsolver time units
relative toleranceadaptive solver
Plummer softening ε0 · exact point law
/ Teaching Tools / Gravitational Dynamics

Anything orbiting anything

No Earth-centered assumption is required. Enter the mass, absolute initial position, and absolute initial velocity of any two bodies. The model uses their relative state to classify the orbit while retaining the inertial motion of both bodies.

Two-body Cartesian initial-condition builder

Body A can move naturally with Body B, or it can be held as an explicit external constraint. Values accept ordinary scientific notation and forms such as 1.989 × 10^30.

r₀ + v₀ + mass · no default center
Initial position r₀km
Initial velocity v₀km/s
Initial position r₀km
Initial velocity v₀km/s
Ready for any finite masses and Cartesian initial conditions. The orbit is determined by the numbers, not by either body’s name.

Extend the complete initial-value problem

The two-body builder feeds this general editor. Add a third body—or up to 64—then edit every mass, position, velocity, and external constraint directly.

Initial state vector

N =
How to edit: click any gold MASS cell, enter a positive value—including 7.35e22, 7.35 × 10^22, or 7.35×10²²—then compile the edited model.Earth + satellite preset compiled
#NameMass · kg · editablex · kmy · kmz · kmvₓ · km/svᵧ · km/sv_z · km/sFixed
Build model to compile the right-hand sideDirect summation · O(N²) · N ≤ 64

Compile orbital geometry into initial conditions

Circular, elliptic, parabolic, and hyperbolic motion are not separate force laws. They are different energy–angular-momentum regimes of the same inverse-square equation. Select an ordered pair, inspect its current osculating conic, or write a new state from first-principles orbital elements.

Osculating-conic laboratory

The secondary is described relative to the primary. For a pure two-body model, these elements define the exact Kepler orbit. In an N-body model they define the instantaneous osculating orbit at the chosen epoch; all other masses perturb it after compilation.

state ↔ elements · no hidden orbit

Construction uses p = rₚ(1+e), then rotates the perifocal state by R₃(Ω)R₁(i)R₃(ω). For two free masses, the pair barycenter and total momentum are preserved exactly.

The audit reads the selected pair directly from the declared state.

Derived from r, v, μ—never inferred from the drawing

select two masses
ε = v²/2 − μ/r determines bound versus escape; e⃗ = (v×h)/μ − r̂ fixes conic shape; h = r×v fixes its plane. Circular requires e ≈ 0 and radial velocity ≈ 0—not a special animation preset.

Generated equations of motion

The generator expands the acceleration of each declared body across every other body. A closed analytic solution is claimed only where one exists; otherwise the equation is propagated numerically and audited.

Compile the model to generate its governing equation.

The requested position solution, ri(t)

not yet compiled
Compile the model to construct the position map.
Acceleration is the differential equation, not the completed motion. This layer reports the exact position function when available, or the declared numerical interpolant when it is not.

Numerical state and interaction audit

Direct pair force

Each RHS evaluation computes all N(N−1)/2 unordered pairs. With ε = 0, acceleration is exactly G m_j Δr / |Δr|³.

Leapfrog KDK

Second-order, symmetric, time-reversible, symplectic kick–drift–kick splitting. Continuous Run advances only whole declared steps; an explicit time seek may use one final shortened step.

Yoshida fourth order

A symmetric composition of second-order symplectic maps with Yoshida coefficients. Continuous Run uses a literal fixed step and reports the last accepted h.

Dormand–Prince 5(4)

Embedded adaptive Runge–Kutta. Rejected steps do not advance time. Accurate locally, but not symplectic.

RK4

Classical fourth-order fixed-step propagation. Useful as a familiar reference, not a structure-preserving long-horizon default.

Position output r(t)

One body is integrated exactly. An unsoftened free pair—or one moving body about one externally fixed primary—uses universal Kepler variables. Every other compiled model exposes a continuous cubic-Hermite position function on accepted solver intervals.

Validity and honesty ledger

What each stage is allowed to claim

System geometry

Every body, pair edge, barycenter, and label is generated from the active state.

TIER A · DIRECT STATE
Acceleration field

Every glyph evaluates the same direct-summation acceleration law at a massless test point.

TIER A · COMPUTED FIELD
Trajectories

Solid fading paths are accepted numerical states. The dashed two-body conic, when present, is independently generated from the exact universal-variable position solution.

TIER A/B · EXACT REFERENCE + MODEL
Invariant history

Residuals are recomputed from the current state and normalized by characteristic scales. Barycenter error is measured against its expected inertial worldline—not against a falsely stationary origin.

TIER A · DIRECT AUDIT
Collision boundary

The point-mass law is singular at zero separation. Softening changes the model; it is never enabled silently.

BOUNDARY DECLARED
Not included

No post-Newtonian terms, radiation, finite radii, mergers, regularization, tree code, or close-encounter controller.

NEWTONIAN DOMAIN ONLY

Methods and primary references